<%@ page language="java" import="java.util.*"  pageEncoding="utf-8"%>
<%@ page import="com.core.ChStr" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<script language="javascript">
function check(form){
}
</script>
<%
			request.setCharacterEncoding("UTF-8"); 
            response.setCharacterEncoding("UTF-8"); 

 %>
<div class="body" id="sellbookrankdiv">
	<!-- 销售书籍排行 -->
	<div style="width:100%;height:40px;margin-left:auto;margin-right:auto;margin-top:5px;" class="word_blue"> 
	&nbsp;&nbsp;当前位置：统计功能 &gt; 销售书籍排行 &gt;&gt;&gt;
	</div>
	<div style="width:100%;height:60px;margin-left:auto;margin-right:auto;margin-top:5px;">
		<form name="bookrangkform" method="post" action="management/<%=session.getAttribute("status") %>-book-rank">
        	<table width="100%" height="38"  border="0" cellpadding="0" cellspacing="0" bgcolor="#E3F4F7" class="tableBorder_gray">
            	<tr>
              		<td bgcolor="#0542C0">
              			&nbsp;<img src="<%=basePath%>/management/Images/search.gif" width="45" height="28">
              			请选择查询依据：
      					<select name="type" class="wenbenkuang" id="type">
        					<option value="CATEGORY_ID" <%if((request.getParameter("type")!=null)&&(((String)request.getParameter("type")).equals("CATEGORY_ID"))){ %> selected="true"<%} %>>书本类别</option>
        					<option value="SHOP_ID" <%if((request.getParameter("type")!=null)&&(((String)request.getParameter("type")).equals("SHOP_ID"))){ %> selected="true"<%} %>>分店号</option>
                  		</select>
      					<input name="key" type="text" id="key"  size="50" <%if(request.getParameter("key")!=null){ %> value=<%=request.getParameter("key") %><%} %>/>
      					<input name="Submit" type="submit" class="btn_grey" value="统计排行">
      			</td>
            	</tr>
          	</table>		
		</form>
	</div>
	<s:if test="bookList.size()==0">
	    <table width="100%" height="30"  border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td height="36" align="center">暂无书籍信息！</td>
        </tr>
    </table>
	</s:if>
	<s:if test="bookList.size()!=0">
    <table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#F6B83B" bordercolorlight="#FFFFFF">
  		<tr align="center" bgcolor="#e3F4F7">
    		<td width="20%" bgcolor="#0542C0">书本编码</td>
  			<td width="20%" bgcolor="#0542C0">书本名称</td>
    		<td width="20%" bgcolor="#0542C0">书本作者</td>
    		<td width="20%" bgcolor="#0542C0">书本类型</td>
    		<td width="20%" bgcolor="#0542C0">书本销售量</td>
  		</tr>
  		<%
  		
			int intPageSize; //一页显示的记录数 
			java.lang.String strRowCount; //记录总数 
			int intPageCount; //总页数 
			int intPage; //待显示页码 
			java.lang.String strPage;
		
			//设置一页显示的记录数 
			intPageSize = 10; 
			//取得待显示页码 
			
			strRowCount = (java.lang.String)request.getAttribute("size");
			int intRowCount = java.lang.Integer.parseInt(strRowCount);
			strPage = request.getParameter("page"); 
			if(strPage==null){//表明在QueryString中没有page这一个参数，此时显示第一页数据 
				intPage = 1; 
			} 
			else{//将字符串转换成整型 
				intPage = java.lang.Integer.parseInt(strPage); 
				if(intPage<1) intPage = 1; 
			} 
			//intRowCount = coll_book.size();//获得总行数
			//intRowCount = 18;
			//记算总页数 
			intPageCount = (intRowCount+intPageSize-1) /intPageSize; 
			//调整待显示的页码 
			if(intPage>intPageCount) intPage = intPageCount; 
			
			java.lang.String key = java.net.URLDecoder.decode(request.getParameter("key"),"UTF-8"); 
		%>
		<!-- 分页处理 -->
  		<form method="post" action="<%=basePath %>management/<%=(String)session.getAttribute("status") %>-book-rank">
  			<input type="hidden" name="type" value="<%=request.getParameter("type") %>"/>
  			<input type="hidden" name="key" value="<%=request.getParameter("key") %>">
			第<%=intPage%>页 共<%=intPageCount%>页 
			<%if(intPage<intPageCount){%>
			<input type="submit" value="下一页" name="cndok1" onclick="downpage(page);" /> 
			<%}%> 
			<%if(intPage>1){%>
			<input type="submit" value="上一页" name="cndok2" onclick="uppage(page);" />
			<%}%> 
			转到第:<input type="text" name="page" id="page" size="8" value="<%=intPage %>" /> 页
			<input type="submit" value="GO" name="cndok3"/> 
		</form> 
		<!-- 分页处理结束 -->
  		
  		
  	<%
  	int n;
  	if(intPage<intPageCount){
  	   n =  intPageSize;
  	}
  	else{
  	   n = intRowCount%intPageSize;
  	}
  	int i;

  	 %>
		<s:iterator value="bookList">
		<tr>
		   <td class="list_data_number">
		          ${bookIsbn }
		  </td>
		<td class="list_data_number">
		         ${bookName }
		</td>
		<td class="list_data_number">
		         ${bookAuthor }
		</td>
		<td class="list_data_number">
		         ${TCategory.categoryName }
		</td>
		<td class="list_data_number">
		         ${bookSellsum }
		</td>
		</tr>
		</s:iterator>  	
	</table>
	
	</s:if>
	

</div>